import request from '../utils/request';

// 地域信息
export function fetchAreas() {
  // options.credentials = 'include';
  return request(`/api/public/city/areas/get`);
}

// 场景信息
export function fetchScene() {
  // options.credentials = 'include';
  return request(`/api/public/scene/get`);
}

// 行业信息
export function fetchIndustry() {
	return request(`/api/public/tag/industry/get`);
}

// 投放人群
export function fetchCrowd() {
	return request(`/api/public/tag/crowd/get`);
}

// 投放媒体
export function fetchMedia() {
  return request(`/api/public/tag/media/get`)
}


// export function submit({ payload }) {
// 	return request(`/dsp/ad/plan/create`, {
// 		method: 'post',
// 		headers:{'Content-Type':'application/json'},
// 	  body: JSON.stringify(payload)
// 	});
// }

export function fetchPacket({ payload }) {
  return request(`/api/dsp/ad/creative/group/list?data=${payload}`);
  // return request(`/mock/593a71098ac26d795fc31e0b/laitui/packetList?data=${payload}`)
}

// 表单提交
export function submit({ payload }) {
	console.log(payload);
	return request(null, {
		method: 'POST',
		url: '/api/dsp/ad/plan/create',
	  data: payload
	});
}

// export function modify({ payload }) {
// 	return request(`/dsp/ad/plan/update`, {
// 		method: 'post',
// 	  data: payload
// 	});
// }

// 表单更新
export function modify({ payload }) {
	return request(null, {
		method: 'POST',
		url: '/api/dsp/ad/plan/update',
	  data: payload
	});
}
